package day01_07.day05;

import java.util.Scanner;

public class Main01 {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        StringBuffer A = new StringBuffer(scn.next());
        int length = A.length();
        String B = scn.next();
        int count = 0;
        for (int i = 0; i < length; i++) {
            A.insert(i , B);
            if (judge(A.toString())){
                count ++;
            }
            A.delete(i , i + 1);
        }
        if (judge(A.append(B).toString())){
            count ++;
        }
        System.out.println(count);

    }
    public static boolean judge(String str){
        char[] c = str.toCharArray();
        for (int i = 0; i < c.length / 2; i++) {
            if (c[i] != c[c.length - 1 - i]){
                return false;
            }
        }
        return true;
    }
}
